﻿@using winproject.Models;
@{
    ViewBag.Title = "Product - Stats | Software-Kart.com";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";

    int resCode = 0;
    ProductStats oItemEditDetail = null;
    if (ViewData != null && ViewData.Keys.Count() > 0 && ViewData.Keys.Contains("resCode"))
    {
        resCode = Convert.ToInt32(ViewData["resCode"]);
    }
    if (resCode == 250)
    {
        oItemEditDetail = (ProductStats)ViewData["resData"];
    }
    
}

@Styles.Render("~/Content/Vendors")
<link type="text/css" rel="stylesheet" href="~/Content/css/jquery-te-1.4.0.css">
<script type="text/javascript" src="~/Scripts/jquery-te-1.4.0.js" charset="utf-8"></script>
@Html.Partial("_LeftMenu")


<!-- content -->
<div class="col-md-10">
    
    <div class="row">
        <div class="panel panel-default bootstrap-admin-no-table-panel">
            <div class="row">
                <div class="col-md-9 text-left">
                    <ol class="breadcrumb">
                      <li><a href="#">Category</a></li>
                      <li><a href="#">Subcategory</a></li>
                      <li class="active">Product: Title</li>
                    </ol> 
                </div>
            </div>
            <div class="panel-heading">
                <div class="text-muted bootstrap-admin-box-title">Product > Stats</div>
            </div>
            <div class="bootstrap-admin-no-table-panel-content bootstrap-admin-panel-content collapse in">
                <form id="frmProdStats" action="~/Products/AddProductStats"  method="post" enctype="multipart/form-data" >
                    @{
                        if (oItemEditDetail != null && (oItemEditDetail.nPid) > 0)
                        {
                            <input type="hidden" id="txtUniqueId" name="txtUniqueId" value="@oItemEditDetail.nPid" />
                        }
                        else
                        {
                            <input type="hidden" id="txtUniqueId" name="txtUniqueId" value="@ViewData["pid"]" />   
                        }
                     }
                <table width="100%"  cellpadding="5" class="table-striped">
                    <tr>
                        <td style="width:200px;vertical-align:top">
                            Enter Prod-Ranking
                        </td>
                        <td style="width:20px;vertical-align:top">:</td>
                        <td>
                            @{
                                <select id="drpRanking" name="drpRanking">
                                @{
                                    <option>--Select Ranking--</option>
                                    for (int minRanking = 1; minRanking <= (Convert.ToInt16(ViewData["maxRanking"])); minRanking++)
                                    {
                                        if (oItemEditDetail != null && (oItemEditDetail.nPRanking) > 0 && (oItemEditDetail.nPRanking) == minRanking)
                                        {
                                            <option value="@minRanking" selected="selected">@minRanking</option>
                                        }
                                        else{
                                            <option value="@minRanking">@minRanking</option>
                                        }
                                    }
                                 }
                                </select>
                            }
                        </td>
                    </tr>
                    <tr>
                        <td style="width:200px;vertical-align:top">
                            Enter Editor's Rating
                        </td>
                        <td style="width:20px;vertical-align:top">:</td>
                        <td>
                            @{
                                <select id="drpRating" name="drpRating">
                                @{
                                    <option>--Select Rating--</option>
                                    for (int minRating = 1; minRating <= 5; minRating++)
                                    {
                                        if (oItemEditDetail != null && (oItemEditDetail.nEditorsRating) > 0 && (oItemEditDetail.nEditorsRating) == minRating)
                                        {
                                            <option value="@minRating" selected="selected">@minRating</option>
                                        }
                                        else{
                                            <option value="@minRating">@minRating</option>
                                        }
                                    }
                                 }
                                </select>
                            }
                        </td>
                    </tr>
                    <tr>
                        <td style="width:200px;vertical-align:top">
                            Enter Download's Rating
                        </td>
                        <td style="width:20px;vertical-align:top">:</td>
                        <td>
                            @{
                                <select id="drpDownloadsRating" name="drpDownloadsRating">
                                @{
                                    <option>--Select Rating--</option>
                                    for (int minDRating = 1; minDRating <= 5; minDRating++)
                                    {
                                        if (oItemEditDetail != null && (oItemEditDetail.nDownloadsRating) > 0 && (oItemEditDetail.nDownloadsRating) == minDRating)
                                        {
                                            <option value="@minDRating" selected="selected">@minDRating</option>
                                        }
                                        else{
                                            <option value="@minDRating">@minDRating</option>
                                        }
                                    }
                                 }
                                </select>
                            }
                        </td>
                    </tr>
                    <tr>
                        <td style="width:200px;vertical-align:top">
                            Enter Download's count
                        </td>
                        <td style="width:20px;vertical-align:top">:</td>
                        <td>
                            @{
                                if (oItemEditDetail != null && (oItemEditDetail.nDownloadCount)>0)
                                {
                                    <input type="text" id="txtDownloadsCount" name="txtDownloadsCount" value="@oItemEditDetail.nDownloadCount"/>
                                }
                                else
                                {
                                    <input type="text" id="txtDownloadsCount" name="txtDownloadsCount" />
                                }
                            }
                        </td>
                    </tr>
                    <tr>
                        <td style="width:200px;vertical-align:top">
                            Enter Visitor's count
                        </td>
                        <td style="width:20px;vertical-align:top">:</td>
                        <td>
                            @{
                                if (oItemEditDetail != null && (oItemEditDetail.nVisitedCount)>0)
                                {
                                    <input type="text" id="txtVisitorsCount" name="txtVisitorsCount" value="@oItemEditDetail.nVisitedCount"/>
                                }
                                else
                                {
                                    <input type="text" id="txtVisitorsCount" name="txtVisitorsCount" />
                                }
                            }
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            &nbsp;
                        </td>
                        <td class="text-left">
                            @{
                                if (oItemEditDetail != null && (oItemEditDetail.nPid) > 0)
                                {
                                    <button type="submit" id="cmdSave" name="cmdSave" value="Save">Save</button>
                                }
                                else
                                {
                                    <button type="submit" id="cmdSave" name="cmdSave" value="Add">Add</button>
                                }
                            }
                            &nbsp; &nbsp;
                            <button type="button" id="cmdCancel" name="cmdSave" value="Cancel" onclick="window.location.href='@HttpContext.Current.Request.ApplicationPath/Admin/SubCategory'">Cancel</button>
                        </td>
                    </tr>
                </table>
                </form>
            </div>
        </div>
    </div>
    
</div>


<script>
    //Declarations
    var itemGridListGlobal = [];

    function ProductStatus() {
        this.nPid =0;
        this.nPRanking =0;
        this.nDownloadCount =0;
        this.nVisitedCount =0;
        this.nEditorsRating =0;
        this.nDownloadsRating =0;
    }

    function editItem(itemid) {
        if (!isNaN(itemid) && parseInt(itemid) > 0) {
            $("#txtUniqueId").val(itemid);
            $("#frmProdStats").attr("action", approotpath + "Products/ProductStatus");
            $("#frmProdStats").submit();
        }
    }
    ////getVirusDetail():: fetches virus details
    //function getCatSubCatProdName(pid) {
    //    $.ajax(approotpath + "Products/GetProductBreadCrumb", {
    //        data: {},
    //        type: "GET",
    //        dataType: 'json',
    //        success: function (data) {
    //            var dataJson = $.parseJSON(data.msgJson);
    //            alert("GetProductBreadCrumb");
    //        }
    //    });
    //}
</script>

